package com.sino.operation.util;

import java.util.UUID;

public class StringUtil {

    public static String getId() {
        return UUID.randomUUID().toString().replaceAll("-", "");

    }

    //型如XXX_YYY_ZZZ的子串改为xxxYyyZxx的子串
    public static String slashToFirstLetterUpper(String input) {
        String spliter = "_";
        StringBuffer output = new StringBuffer();
        String[] words = input.toLowerCase().split(spliter);
        for (int i = 0; i < words.length; i++) {
            if (i != 0) {
                output.append(fistLetterToUpper(words[i]));
            } else {
                output.append(words[i]);
            }
        }

        return output.toString();
    }

    private static String fistLetterToUpper(String input) {
        if (input == null) {
            return "";
        }
        if (input.length() <= 0) {
            return "";
        }

        return input.substring(0, 1).toUpperCase() + input.substring(1);
    }
}
